package models;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;

import play.db.jpa.GenericModel;
import play.libs.Codec;
import utils.StringUtils;

@Entity
@Table(name = "password_question")
public class PasswordQuestion extends BasicModel{

	
	@Column(name = "user_id")
	public String userId;
	
	@Column(name = "question")
	public String question;
	
	@Column(name = "solution")
	public String solution;
	
	public static PasswordQuestion findByUserId(String id){
		return find("userId = ?", id).first();
	}
	public boolean isAllNotNull(){
		if(!StringUtils.isEmpty(this.question)&&!(StringUtils.isEmpty(this.solution)))
		{
			return true;
		}
		else{
		return false;
		}
	}
}
